{% extends "base_student.html" %} 

{% block content %}
<div class="container mt-4">
  <div class="row">
    <div class="col-md-3 text-center">
      <img src="{{ student.avatar_url | avatar_url(student.username) if student.avatar_url else url_for('static', filename='icons/i.jpg') }}"
           alt="{{ 'Аватар пользователя' if student.avatar_url else 'Стандартный аватар' }}"
           class="rounded-circle img-fluid" style="width: 150px; height: 150px; object-fit: cover; border-radius: 50%;" />
    </div>
    <div class="col-md-9">
      <div class="d-flex align-items-center mb-3">
        <h2 class="me-3">{{ student.surname }} {{ student.first_name }} {{ student.middle_name }}</h2>
        {% if student == current_user %}<a href="#" class="btn btn-dark">Редактировать профиль</a>{% endif %}
      </div>
      <ul class="list-group list-group-flush">
        <li class="list-group-item"><strong>Ник:</strong> {{ student.username }}</li>
        <li class="list-group-item"><strong>Номер телефона:</strong> {{ student.phone_number }}</li>
        <li class="list-group-item"><strong>Email:</strong> {{ student.email }}</li>
        <li class="list-group-item"><strong>О себе:</strong> {{ student.about }}</li>
      </ul>
    </div>
  </div>
  <div class="row mt-4">
    <div class="col-md-12"><h3>Портфолио</h3></div>
  </div>
  <div class="row row-cols-1 row-cols-md-2 row-cols-lg-3 g-4">
    {% for project in student.projects %}
    <div class="col">
      <div class="card h-100 shadow-sm">
        <img src="{{ project.files[0].filename if project.files else url_for('static', filename='default_project_image.jpg') }}"
             class="card-img-top" alt="{{ project.title | default('Стандартное изображение проекта') }}" />
        <div class="card-body">
          <h5 class="card-title">{{ project.title }}</h5>
          <p class="card-text">{{ project.description }}</p>
        </div>
        <div class="card-footer text-muted">
          <small>Область: {{ project.field }}</small>
        </div>
      </div>
    </div>
    {% endfor %}
  </div>
</div>
{% endblock %}